﻿using System;
using System.Runtime.Serialization;
using GameBoard;

namespace CombatAutomationTheater
{
    [DataContract]
    public class StatusEffect
    {
        public StatusEffect(string description, int duration, int modifier)
        {
            Description = description;
            DurationRemaining = duration;
            Modifier = modifier;
        }

        [DataMember]
        public String Description { get; set; }

        [DataMember]
        public int DurationRemaining { get; set; }

        [DataMember]
        public int Modifier { get; set; }

        public StatusEffectDisplay StatusEffectDisplay { get; set; }

        /// <summary>
        ///     Used to pass the info without a circular dependency.
        /// </summary>
        /// <returns></returns>
        public StatusEffectDisplay CreateStatusEffectDisplay()
        {
            string moddesc = "";
            if (Modifier > 0)
            {
                moddesc = "+" + Modifier;
            }
            if (Modifier < 0)
            {
                moddesc = "-" + Modifier;
            }
            return new StatusEffectDisplay
            {
                Description = Description,
                TurnsRemaining = DurationRemaining.ToString(),
                ModifierDescription = moddesc
                
            };
        }
    }
}